﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using BUS;

namespace NGU.WUC
{
    public partial class dat_phong_dang_ky : System.Web.UI.UserControl
    {
        protected List<HangPhongDTO> hangPhongLst = new List<HangPhongDTO>();
        protected List<LoaiPhongDTO> loaiPhongLst = new List<LoaiPhongDTO>();
        protected NhaCungCapDTO ncc = new NhaCungCapDTO();
        protected List<RoomDTO> roomLst = new List<RoomDTO>();
        protected KhachHangDTO kh;
        protected void Page_Load(object sender, EventArgs e)
        {
            HotelBUS hotelBus = new HotelBUS();
            this.hangPhongLst = hotelBus.layDSHangPhong();
            this.loaiPhongLst = hotelBus.layDSLoaiPhong();
            NhaCungCapBUS nccBus = new NhaCungCapBUS();
            KhachHangBUS khBus = new KhachHangBUS();
            this.kh = khBus.layThongTinKhachHangTheoMaTK(Session["ID"].ToString());
            Session["KhachHang"] = this.kh;
            if (this.kh == null)
            {
                this.kh = new KhachHangDTO();
            }
            
            if (Request["hotelIndex"] != null)
            {
                this.ncc = nccBus.layDSNhaCungCapTheoLoaiNCC("Dịch vụ khách sạn")[int.Parse(Request["hotelIndex"].ToString())];
                this.roomLst = hotelBus.layDanhSachGiaPhong(int.Parse(Request["hotelIndex"].ToString()),this.loaiPhongLst, this.hangPhongLst);
            }
            else
            {
                this.ncc = nccBus.layDSNhaCungCapTheoLoaiNCC("Dịch vụ khách sạn")[0];
                this.roomLst = hotelBus.layDanhSachGiaPhong(0,this.loaiPhongLst, this.hangPhongLst);
            }
                       
        }

        protected void nextBut_Click(object sender, EventArgs e)
        {
            //try
            //{
            //    //kiem tra thong tin dat phong
            //    string fromdateStr = this.inp_fromdate.Value;
            //    string todateStr = this.inp_todate.Value;
            //    string soluongStr = this.inp_roomquantity.Value;
            //    DateTime fromDate;
            //    DateTime toDate;
            //    int soLuongPhong;

            //    try
            //    {
            //        fromDate = DateTime.Parse(fromdateStr);
            //    }
            //    catch (Exception ex)
            //    {
            //        Response.Redirect("/DatPhong.aspx?action=error&type=fromdate");
            //    }
            //}
            //catch (Exception ex)
            //{

            //}

        }
    }

}